import requests
import re
from bs4 import BeautifulSoup

# 获取网页源代码
url = 'http://www.hljcourt.gov.cn/public/paperview.php?id=1182155'

response = requests.get(url=url)
response.encoding = 'GBK'
# print(response.text)
# 使用的解析器是html.parser
soup = BeautifulSoup(response.text, 'html.parser')
temp = soup.prettify() + '<'
result = ''
i = 0
while i < len(temp):
    if temp[i] == '>':
        i += 1
        while temp[i] != '<':
            result += temp[i]
            i += 1
    i += 1
result = re.sub("[{}\n\t ]", "", result)
result.split()
print(result)
